<?php /* CONTACTS $Id: do_contact_aed.php,v 1.5 2005/01/17 07:48:25 ajdonnison Exp $ */
require_once(DP_BASE_DIR."/modules/companies/companies.class.php");
$obj = new CCompany();
$results = array('success' => TRUE, 'messages' => '');

if (!($msg = $obj->bind( $_POST ))) {
	$results['success'] = FALSE;
	$results['messages'] = $msg;
}
$del = intval(dPgetParam( $_REQUEST, 'company_id', 0 ));

if ($del>0) {
	if (($msg = $obj->delete())) {
		$results['success'] = FALSE;
		$results['messages'] = $msg;
	}
}

header('Content-Type: text/xml');

$xml = new XmlWriter();
$xml->openMemory();
$xml->startDocument('1.0', 'UTF-8');

$xml->startElement('root');

$xml->writeElement('company_id', $obj->company_id);
$xml->writeElement('success', $results['success'] ? 'true' : 'false');
$xml->writeElement('messages', $results['messages']);
$xml->writeElement('errors', $results['messages']);

$xml->endElement();

echo $xml->outputMemory(true);
?>